﻿#ifndef DELEGATECENTER_H
#define DELEGATECENTER_H
#include <QItemDelegate>

class EnumDelegate : public QItemDelegate
{
    Q_OBJECT
public:
   EnumDelegate(QStringList enumStringList, QObject *parent=nullptr);
   
private:
   QStringList enumStringList;
   
public:
   void initStyleOption(QStyleOptionViewItem *option,const QModelIndex &index) const;
   QString getDisplayText(const QModelIndex &index) const;
   
protected:
   void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
};

class NumberDelegate : public QItemDelegate
{
    Q_OBJECT
public:
   NumberDelegate(int precision, QObject *parent=nullptr);

private:
   int precision;

public:
   void initStyleOption(QStyleOptionViewItem *option,const QModelIndex &index) const;
   QString getDisplayText(const QModelIndex &index) const;

protected:
   void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
};

#endif // DELEGATECENTER_H
